#pragma once

#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <streams.h>

#define SAFE_RELEASE(p) if(p) { p->Release(); p = NULL; }

template<typename T>
class AutoReleaser
{
public:
	AutoReleaser(T *pRes) : m_pRes(pRes) {	}
	~AutoReleaser() { if(m_pRes) m_pRes->Release(); }
private:
	T *m_pRes;
};

#define AUTO_RELEASE(type, res) \
	AutoReleaser<type> donot_user_me_auto_releaser_##res (res)